package com.element.item;

import java.util.ArrayList;

import tools.XMLParser;
import world.World;

import android.util.Log;

import com.element.ElementList;

/* Handles a list of items*/
public class ItemList extends ArrayList<Item> {
	
	private static String xmlPath = "res/raw/itemlist.xml";
	
	public ItemList(String id, World world){
		XMLParser parser = new XMLParser();
		parser.setList(id, this, xmlPath, world);

	}
	
	public Item getItem(int i){
		return this.get(i);
	}
	/* Add one or more items to list l*/
	public void addItems(ItemList il, Item... args){
		for (Item i : args) {
			il.add(i);
		}
	}

	/* Remove one or more items from list l*/
	public void removeItems(ItemList il, Item... args){
		for (Item it : args) {
			for(int i = 0; i < il.size(); i++){
				if(il.get(i) == it){
					il.remove(i);
				}
			}
		}
	}
}
